package com.shilin.watchsystem.exception;



import com.shilin.watchsystem.util.ResultUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 全局异常处理
 *
 * @author jade
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = AppException.class)
    @ResponseBody
    public Object defaultErrorHandler(AppException e) {
        return ResultUtil.error(e.getCode(), e.getMessage());
    }
}